package com.tiger.cloud.model.crm;

import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.util.Date;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tiger.cloud.common.mybatis.TigerBaseEntity;
import com.tiger.cloud.enums.CommucationCustomerType;
import com.tiger.cloud.enums.DeleteEnum;
import com.tiger.cloud.enums.YesOrNoEnum;
import com.tiger.cloud.security.EncodeUtil;

import io.swagger.annotations.ApiModelProperty;
/**
 * 
 * crm_commucation-交流记录
 *
 */
public class Commucation extends TigerBaseEntity{

	private static final long serialVersionUID = 1L;
    
	/**
	 * 所属用户
	 */
	@ApiModelProperty(value = "所属用户")
    private Long userId;
	/**
	 * 交流对象
	 */
    @ApiModelProperty(value = "交流对象")
    private Long customerId;
    /**
	 * 客户类型   1:客户、2:同行
	 */
    @ApiModelProperty(value = "客户类型   1:客户、2:同行")
    private CommucationCustomerType customerType;
    /**
	 * 客户/同行等级
	 */
    @ApiModelProperty(value = "客户/同行等级")
    private String customerLevel;
    /**
	 * 客户/同行头像
	 */
    @ApiModelProperty(value = "客户/同行头像")
    private String customerImage;
    /**
     * 客户/同行名称
     */
    @ApiModelProperty(value = "客户/同行名称")
    private String customerName;
	/**
	 * 
	 */

    @ApiModelProperty(value = "内容")
    private String content;
    @JsonIgnore
	private String content_;

    
    @DateTimeFormat(pattern="yyyy-MM-dd")   
	@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8") 
    private Date commucationDate;
	/**
	 * 
	 */
    private Timestamp createTime;
	/**
	 * 
	 */
    private Timestamp lastUpdateTime;
    /**
     * 当前时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")   
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
    @ApiModelProperty(value = "当前时间")
    private Timestamp currentTime;
	/**
	 * 
	 */
    private String attachment;
	/**
	 * 是否删除, 0:正常,1:删除
	 */
    private DeleteEnum isDelete=DeleteEnum.NOMAIL;
    /**
     * 是否系统消息   1:是，2:不是
     */
    private YesOrNoEnum isSystemMsg;
    
    public Commucation(){
    
    }
    
    public String getContent_() {
    	if(null == content){
    		return null;
    	}
		try {
			return EncodeUtil.urlEncode(content);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		};
		return null;
	}

	public void setContent_(String content_) {
		if( null == content_){
    		return;
    	}
		try {
			this.content= EncodeUtil.urlDecode(content_);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		};
	}

	public YesOrNoEnum getIsSystemMsg() {
		return isSystemMsg;
	}

	public void setIsSystemMsg(YesOrNoEnum isSystemMsg) {
		this.isSystemMsg = isSystemMsg;
	}

	public Timestamp getCurrentTime() {
		return currentTime;
	}

	public void setCurrentTime(Timestamp currentTime) {
		this.currentTime = currentTime;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public Long getUserId() {
        return this.userId;
    }
    
    public CommucationCustomerType getCustomerType() {
		return customerType;
	}

	public void setCustomerType(CommucationCustomerType customerType) {
		this.customerType = customerType;
	}

	public String getCustomerLevel() {
		return customerLevel;
	}

	public void setCustomerLevel(String customerLevel) {
		this.customerLevel = customerLevel;
	}

	public String getCustomerImage() {
		return customerImage;
	}

	public void setCustomerImage(String customerImage) {
		this.customerImage = customerImage;
	}

	public void setUserId(Long userId) {
        this.userId = userId;
    }
    public Long getCustomerId() {
        return this.customerId;
    }
    
    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }
    public String getContent() {
    	if(null == content){
    		return null;
    	}
		try {
			return EncodeUtil.urlDecode(content);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		};
        return null;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    public Date getCommucationDate() {
        return this.commucationDate;
    }
    
    public void setCommucationDate(Date commucationDate) {
        this.commucationDate = commucationDate;
    }
    public Timestamp getCreateTime() {
        return this.createTime;
    }
    
    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
    public Timestamp getLastUpdateTime() {
        return this.lastUpdateTime;
    }
    
    public void setLastUpdateTime(Timestamp lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }
    public String getAttachment() {
        return this.attachment;
    }
    
    public void setAttachment(String attachment) {
        this.attachment = attachment;
    }
    public DeleteEnum getIsDelete() {
        return this.isDelete;
    }
    
    public void setIsDelete(DeleteEnum isDelete) {
        this.isDelete = isDelete;
    }
    
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}